home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / Examples / DriverKit / Adaptec1542B / Adaptec1542B_reloc.tproj / AHAControllerPrivate.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-05  |  2.3 KB  |  104 lines

  1. /*
  2.  * Copyright (c) 1993-1996 NeXT Software, Inc.
  3.  *
  4.  * AHAControllerPrivate.h - Adaptec 1542 SCSI controller private typedefs.
  5.  *
  6.  * HISTORY
  7.  *
  8.  * 13 Apr 1993    Doug Mitchell at NeXT
  9.  *    Created.
  10.  */
  11.  
  12. #import <machkit/NXLock.h>
  13. #import <mach/mach_types.h>
  14. #import <mach/message.h>
  15. #import <driverkit/interruptMsg.h>
  16. #import "AHAController.h"
  17. #import "AHATypes.h"
  18. #import <driverkit/debugging.h>
  19.  
  20. /*
  21.  * Command to be executed by I/O thread.
  22.  */
  23. typedef enum { 
  24.     AO_Execute,        // execute IOSCSIRequest
  25.     AO_Reset,        // reset bus
  26.     AO_Abort        // abort I/O thread
  27. } AHAOp;
  28.  
  29. /*
  30.  * Command struct passed from exported methods (executeRequest and 
  31.  * resetSCSIBus) to the I/O thread. This struct is passed via commandQ.
  32.  */
  33. typedef struct {
  34.     AHAOp        op;        // AO_Execute, etc.
  35.     
  36.     /*
  37.      * The following 3 fields are only valid if op == AH_Execute.
  38.      */
  39.     IOSCSIRequest    *scsiReq;
  40.     void        *buffer;    
  41.     vm_task_t    client;
  42.     
  43.     sc_status_t    result;        // status upon completion
  44.     NXConditionLock    *cmdLock;    // client waits on this
  45.     queue_chain_t    link;        // for enqueueing on commandQ
  46. } AHACommandBuf;
  47.  
  48. /*
  49.  * Condition variable states for AHACommandBuf.cmdLock.
  50.  */
  51. #define CMD_PENDING    0
  52. #define CMD_COMPLETE    1
  53.  
  54. /*
  55.  * DDM masks and macros.
  56.  */
  57. /*
  58.  * The index into IODDMMasks[].
  59.  */
  60. #define AHA_DDM_INDEX    2
  61.  
  62. #define DDM_EXPORTED    0x00000001    // exported methods
  63. #define DDM_IOTHREAD    0x00000002    // I/O thread methods
  64. #define DDM_INIT    0x00000004    // Initialization
  65.  
  66. #define ddm_exp(x, a, b, c, d, e)                     \
  67.     IODEBUG(AHA_DDM_INDEX, DDM_EXPORTED, x, a, b, c, d, e)
  68.     
  69. #define ddm_thr(x, a, b, c, d, e)                     \
  70.     IODEBUG(AHA_DDM_INDEX, DDM_IOTHREAD, x, a, b, c, d, e)
  71.  
  72. #define ddm_init(x, a, b, c, d, e)                     \
  73.     IODEBUG(AHA_DDM_INDEX, DDM_INIT, x, a, b, c, d, e)
  74.  
  75.  
  76. /*
  77.  * Public low-level routines in AHARoutines.m.
  78.  */
  79. extern void aha_reset_board(unsigned short base, 
  80.     unsigned char     aha_board_id);
  81. boolean_t aha_setup_mb_area(unsigned short base,
  82.     struct aha_mb_area *aha_mb_area,
  83.     struct ccb     *aha_ccb);
  84. extern void aha_start_scsi(unsigned short base);
  85. extern void aha_unlock_mb(unsigned short base);
  86. extern boolean_t aha_cmd(unsigned short    base,
  87.     unsigned char    cmd,
  88.     unsigned char    *args,
  89.     int        arglen,
  90.     unsigned char    *reply,
  91.     int        replylen,
  92.     boolean_t    polled
  93. );
  94. extern boolean_t aha_probe_cmd(
  95.     unsigned short    base,
  96.     unsigned char    cmd,
  97.     unsigned char    *args,
  98.     int        arglen,
  99.     unsigned char    *reply,
  100.     int        replylen,
  101.     boolean_t    polled
  102. );
  103.  
  104.